package yanc.app

import grails.transaction.Transactional
import org.springframework.beans.factory.annotation.Value

@Transactional
class VersionService {

    @Value('${versionService.u}')
    protected String URL

    def add(Version version) {
        version.url = URL
        version.insert()
    }

    def del(Integer id) {
        def version = Version.findById(id)
        version.delete()
    }

    def update(Version version) {
        version.save()
        if (!version.save()) {
            version.errors.allErrors.each {
                println it
            }
        }
    }
}
